const puppeteer = require('puppeteer');
(async () => {
    const browser = await puppeteer.launch({    //启动浏览器
        args: ['--no-sandbox'],
        headless: false,   //代码运行时打开浏览器方便观察
        // devtools:true   //打开f12界面
    });    const page = await browser.newPage()

    const navigationPromise = page.waitForNavigation()

    await page.goto('https://www.baidu.com/')

    await page.setViewport({ width: 1653, height: 1243 })

    await navigationPromise

    await page.waitForSelector('.s_form #kw')
    await page.click('.s_form #kw')

    await page.type('.s_form #kw', '测试ppppp')

    await page.waitForSelector('.s_form #su')
    await page.click('.s_form #su')

    // await browser.close()
})()